package com.zbf.config2;

import org.springframework.beans.factory.config.BeanDefinition;
import org.springframework.context.annotation.Condition;
import org.springframework.context.annotation.ConditionContext;
import org.springframework.core.type.AnnotatedTypeMetadata;

/**
 * @author: LI-CI-GAO
 * 作者: licigao
 * 日期: 2021/9/10  10:16
 * 描述:
 */
public class MyCondition02 implements Condition {
    @Override
    public boolean matches(ConditionContext conditionContext, AnnotatedTypeMetadata annotatedTypeMetadata) {

        BeanDefinition myIntercepter2 = null;

        try {
            myIntercepter2= conditionContext.getRegistry().getBeanDefinition("myIntercepter2");
        }catch (Exception e){
            e.printStackTrace();
        }finally {
            if(myIntercepter2==null){
                return false;
            }else{
                return true;
            }
        }





    }
}
